package com.rzcf.blink.pay.infrastructure.gateway.upstream.tiannuo.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


/**
 * 号卡管家订单状态枚举类
 *
 * @author dongsf
 */
@Getter
@AllArgsConstructor
public enum ButlerOrderStatusEnum {

    /**
     * 异常单 该订单为有可挽可能性
     */
    ABNORMAL("abnormal", "异常单"),
    /**
     * 已拦截 地址，黑名单等前置拦截
     */
    INTERCEPT("intercept", "已拦截"),
    /**
     * 待修改(可修改后重新下单)
     */
    WAIT_EDIT("wait_edit", "待修改"),
    /**
     * 此状态可在一定时间内重新提交
     */
    WAIT_AGAIN("wait_again", "待重提"),
    /**
     * 已失败
     */
    ERROR("error", "已失败"),
    /**
     * 处理中
     */
    IN_PROCESS("in_process", "处理中"),
    /**
     * 审核中
     */
    UNDER_REVIEW("under_review", "审核中"),
    /**
     * 待发货
     */
    NO_SHIPPED("no_shipped", "待发货"),
    /**
     * 已发货
     */
    SHIPPED("shipped", "已发货"),
    /**
     * 已激活
     */
    ACTIVATE("activate", "已激活"),
    /**
     * 已首冲
     */
    FIRST_FLUSH("first_flush", "已首冲"),
    /**
     * 待三证
     */
    WAIT_PHOTO("wait_photo", "待三证");

    /**
     * 编码
     */
    private final String code;
    /**
     * 说明
     */
    private final String message;
    private static final Map<String, ButlerOrderStatusEnum> CODE_ENUM_MAP = Arrays
            .stream(ButlerOrderStatusEnum.values())
            .collect(Collectors.toMap(ButlerOrderStatusEnum::getCode, type -> type));

    public static final List<String> FAIL_STATUS = new ArrayList<>();
    public static final List<String> SAVE_STATUS = new ArrayList<>();

    static {
        FAIL_STATUS.add(ButlerOrderStatusEnum.ABNORMAL.getCode());
        FAIL_STATUS.add(ButlerOrderStatusEnum.INTERCEPT.getCode());
        FAIL_STATUS.add(ButlerOrderStatusEnum.ERROR.getCode());

    }

    static {
        SAVE_STATUS.add(ButlerOrderStatusEnum.WAIT_EDIT.getCode());
        SAVE_STATUS.add(ButlerOrderStatusEnum.WAIT_AGAIN.getCode());
    }

}
